<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<div th:insert="/common/common.html"></div>
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        function getTree() {
            var tree = "";
            $.ajax({
                url: "/menu/getInfo",
                dataType: "json",
                type: "get",
                async: false,
                success: function (result) {
                    tree = result;
                }, error: function (result) {
                    toastr.error("报错了")
                }
            })
            return tree;
        }

        $(function () {
            $('#tree').treeview({
                data: getTree(),
                showCheckbox: "glyphicon glyphicon-check",
                onNodeSelected: function (event, data) {

                    if (data.url != null) {
                        $.addtabs.add({
                            title: (data.text),
                            url: data.url,
                            id: data.id
                        })
                    }
                }
            });
        })

        function loginOut(){
            location.href = "/loginOut";
        }
    </script>
    <style>
        .iframeClass{
            height: 600px !important;
        }
    </style>
</head>
<body>

<div class="container-fluid">
    <button type="button" onclick="loginOut()" class="btn btn-default btn-xs">
        <span class="glyphicon glyphicon-user"></span> 退出登录
    </button>
    <div class="row">
        <div class="col-md-3">
            <div id="tree"></div>
        </div>
        <div class="col-md-9">
            <ul class="nav nav-tabs" id="myTab"></ul>
            <div class="tab-content"></div>
        </div>
    </div>
</div>
</body>
</html>